#ifndef _ICECODE_HTTPSERVER
#define _ICECODE_HTTPSERVER

#include <string>

namespace icecode {
  namespace http {
    class HTTPServer {
    public:
      struct HTTPOptions
      {
	HTTPOptions() { root_dir = "/var/www/localhost"; listen_addr = "127.0.0.1"; listen_port = 8080; max_conn = 64; }
	HTTPOptions& operator =(const HTTPOptions &opts);

	std::string root_dir; //root directory
	std::string listen_addr; //listen address
	unsigned long int listen_port; //listen port
	int max_conn; //maximum connections (-1 for unlimited)
      };

      HTTPServer(HTTPOptions *opts = 0);
      ~HTTPServer();

      /*
       * Run the server
       */
      void run();

      const HTTPOptions& getOptions() const { return opts; }

    private:
      HTTPOptions opts;
      bool quit;
      unsigned int errcount;
      unsigned int connections;
    };
  }
}

#endif //_ICECODE_HTTPSERVER
